home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / FNTPAK32.ZIP / C.EXE / DEMO_LIN.C < prev    next >
C/C++ Source or Header  |  1995-08-16  |  3KB  |  103 lines

  1.  
  2. /*******************************************************************
  3.  
  4.     Demo_Lin.C                    Copyright 1994, Rob W. Smetana
  5.  
  6.     NOTE:  Turn screen swapping ON if appropriate!
  7.  
  8.     Font Pak demo program which shows how to:
  9.  
  10.       1.  Use SetMaxLines (...) to switch to 12 - 100 lines on
  11.           the screen -- in TEXT mode!
  12.  
  13.       2.  Load a Font Pak font (from 4 to 24 points) to finish
  14.           the process.
  15.  
  16.     Requires:
  17.  
  18.       a.  A callable Font Pak font (e.g., Tiny04.F06)
  19.       b.  Procedures in Lines.Obj (SetmaxLines, WriteChar, etc.)
  20.  
  21. ********************************************************************/
  22.  
  23. #include <font_pak.h>            /* for prototypes */
  24. #include <dos.h>                 /* for int86      */
  25. #include <conio.h>
  26.  
  27. #define Video 0x10               /* set text mode  */
  28. #define SetVMode 0
  29. #define TextCO80 3
  30.  
  31. #define Char_Gen 0x11            /* select 43/50 lines */
  32. #define Rom8x8   0x12
  33. #define Block    0
  34.  
  35. void TextMode (void);            /* local prototypes */
  36. void Select43_50 (void);
  37.  
  38.  
  39. int  extern pascal far GETMONITOR(void);
  40. void extern pascal far TINY04(int BlockNum);
  41. int  extern pascal far SETMAXLINES(int FontHeight);
  42. void extern pascal far WRITECHAR  (int Row, int Col, int AscCode, int Colr);
  43.  
  44. /***********************************************************************/
  45.  
  46. int main (void)
  47.  
  48. {
  49.  
  50.    int LenString, CharHite, NumLines, Char, Row, Col, AsciiCode;
  51.    char s[40],l[3];
  52.    if (GETMONITOR() < 4)         /* Bail out if no EGA/VGA */
  53.          {
  54.           printf ("Sorry. This demo requires an EGA, VGA or compatible monitor.");
  55.           return (-99);
  56.          }
  57.  
  58.    strcpy (s, " Here's a new line.   Press <enter>...");
  59.  
  60.    TextMode();                     /* set video mode; ensure text mode */
  61.    Select43_50();                  /* get max # of lines */
  62.  
  63.    CharHite = 6;                   /* tiny04 is a 4-point font in 6x8 grid */
  64.    NumLines = SETMAXLINES (CharHite);
  65.    TINY04 (0+100);                 /* re-map block 0 -- the default font */
  66.                                    /* BE SURE to add 100 to block #      */
  67.  
  68.    printf ("            Using font Tiny04, we can get %d lines on the screen! ", NumLines);
  69.  
  70.    for (Row = 3; Row <= NumLines; Row++)
  71.           {
  72.           for (Char = 1; Char<38; Char++)
  73.               {
  74.                  AsciiCode = s[Char];
  75.                  WRITECHAR (Row, 22+Char, AsciiCode, 79);
  76.               }
  77.           }
  78.    getch();
  79.    TextMode();                                 /* restore some normalcy */
  80.    return (0);
  81. }
  82.  
  83.  
  84. void TextMode (void)
  85. {
  86.     union REGS reg;
  87.  
  88.     reg.h.ah = SetVMode;
  89.     reg.h.al = TextCO80;
  90.     int86 (Video, ®, ®);
  91. }
  92.  
  93. void Select43_50 (void)
  94. {
  95.     union REGS reg;
  96.  
  97.     reg.h.ah = Char_Gen;
  98.     reg.h.al = Rom8x8;
  99.     reg.h.bl = Block;
  100.     int86 (Video, ®, ®);
  101. }
  102.  
  103.